#include "GetPipe.hpp"
#include <fcntl.h>
#include <unistd.h>
#include <cstring>
#include <string>
int main()
{
    int fd = open(PIPE_FILE,O_WRONLY);
    if(fd < 0)
    {
        perror("open");
        exit(errno);
    }

    while(true)
    {
        std::string s;
        std::cout << "请输入消息:" ;
        std::getline(std::cin,s);
        if(write(fd,s.c_str(),s.size()) < 0)
        {
            perror("read");
            exit(errno);
        }
    }
    close(fd);
    return 0;
}